home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Layout / Border.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  2.7 KB  |  114 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Border.cpp
  3.  
  4.     Contains:    Implementation of active border display routines
  5.  
  6.     Owned by:    Joshua Susser
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.     
  12.          <4>     6/20/95    JBS        1257315 change Facet::AcquireWindow to
  13.                                     GetWindow
  14.          <3>     5/26/95    RR        #1251403: Multithreading naming support
  15.          <2>     5/17/95    JBS        1242496 remove SOM_CATCH
  16.          <1>     2/28/95    JBS        first checked in
  17.          <0>     2/28/95    JBS        1198509 created
  18. */
  19.  
  20. /*
  21. These functions are private utilities for use by ODFacet to display and
  22. invalidate the active border.  The functions are platform-dependent, in
  23. that they make direct calls to the platform graphics system.
  24. */
  25.  
  26. #ifndef _BORDER_
  27. #include "Border.h"
  28. #endif
  29.  
  30. #ifndef SOM_ODFacet_xh
  31. #include <Facet.xh>
  32. #endif
  33.  
  34. #ifndef SOM_ODCanvas_xh
  35. #include <Canvas.xh>
  36. #endif
  37.  
  38. #ifndef SOM_ODShape_xh
  39. #include <Shape.xh>
  40. #endif
  41.  
  42. #ifndef SOM_ODWindow_xh
  43. #include <Window.xh>
  44. #endif
  45.  
  46. #ifndef __QUICKDRAW__
  47. #include <QuickDraw.h>
  48. #endif
  49.  
  50. #pragma segment ODFacet
  51.  
  52. //==============================================================================
  53. // Global variables
  54. //==============================================================================
  55.  
  56. extern Pattern borderPattern;
  57.  
  58. //==============================================================================
  59. // Functions
  60. //==============================================================================
  61.  
  62. //------------------------------------------------------------------------------
  63. // ODDrawBorder
  64. //------------------------------------------------------------------------------
  65.  
  66. void
  67. ODDrawBorder(Environment *ev, ODShape* borderShape, ODFacet* facet)
  68. {
  69.     GrafPtr savePort;
  70.  
  71.     ODWindow* window = facet->GetWindow(ev);
  72.     if ( window != kODNULL )
  73.     {
  74.         GetPort(&savePort);
  75.         
  76.         SetPort((GrafPtr)(window->GetRootFacet(ev)->
  77.                     GetCanvas(ev)->GetPlatformCanvas(ev, kODQuickDraw)));
  78.         SetOrigin(0,0);
  79.         ClipRect(&(ODQDGlobals.thePort->portRect));    
  80.     
  81.         RgnHandle borderRgn = borderShape->GetQDRegion(ev);
  82.         FillRgn(borderRgn, &borderPattern);
  83.         
  84.         SetPort(savePort);
  85.     }
  86. }
  87.  
  88. //------------------------------------------------------------------------------
  89. // ODInvalidateBorder
  90. //------------------------------------------------------------------------------
  91.  
  92. void
  93. ODInvalidateBorder(Environment *ev, ODShape* borderShape, ODFacet* facet)
  94. {
  95.     GrafPtr savePort;
  96.  
  97.     ODWindow* window = facet->GetWindow(ev);
  98.     if ( window != kODNULL )
  99.     {
  100.         GetPort(&savePort);
  101.         
  102.         SetPort((GrafPtr)(window->GetRootFacet(ev)->
  103.                     GetCanvas(ev)->GetPlatformCanvas(ev, kODQuickDraw)));
  104.         SetOrigin(0,0);
  105.         ClipRect(&(ODQDGlobals.thePort->portRect));    
  106.     
  107.         RgnHandle borderRgn = borderShape->GetQDRegion(ev);
  108.         InvalRgn(borderRgn);
  109.         
  110.         SetPort(savePort);
  111.     }
  112. }
  113.  
  114.